/**
 * @file contests/cf1702/a/main.cpp
 * @brief
 * @see
 * @author Ruiming Guo (guoruiming@stu.scu.edu.cn)
 * @copyright 2022
 * @date 2022/7/10 22:02:28
 **/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main() {
  // High rating and good luck!
  int tc;
  cin >> tc;
  while (tc--) {
    ll n;
    cin >> n;
    ll newPrice = 10;
    while (newPrice < n) newPrice *= 10;
    if (n == newPrice)
      cout << 0 << endl;
    else
      cout << n - newPrice / 10 << endl;
  }
  return 0;
}
